import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import store from "./store"
import { Provider } from "react-redux"
import decode from "jwt-decode"
import { syncInfoAc } from "./pages/Login/store/actonCreates"
const tk = localStorage.getItem("@TOKEN")

try {
  if (tk) {
    store.dispatch(syncInfoAc(decode(tk)))
  }
} catch {
  localStorage.removeItem('@TOKEN')
  window.location.href = "/login"; 
}


ReactDOM.render(
  (
    <Provider store={store}>
      <App />
    </Provider>
  )
  ,
  document.getElementById('root')
);
